#verbose 可以加上-v 缩短输入
# import argparse
# parser = argparse.ArgumentParser()
# parser.add_argument("-v", "--verbose", action = "store_true", help = "verbose")
# args = parser.parse_args()
# if args.verbose:
#     print("Yes")

#count 是统计出现-v的次数 所以在后面赋值是报错的
#py test.py 4 -v 1 是报错的
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("square", type=int,
help="display the square of a given number")
parser.add_argument("-v", "--verbosity", action="count",
help="increase output verbosity")
args = parser.parse_args()
answer = args.square**2
if args.verbosity == 2:
    print(f"the square of {args.square} equals {answer}")
elif args.verbosity == 1:
    print(f"{args.square}^2 == {answer}")
else:
    print(answer)